package com.kaochong.xcx.enums;

import com.kaochong.xcx.exception.KaoChongException;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * @author han
 * @date 2018-05-02 11:00
 */
@Getter
@Slf4j
public enum StageStatus {
	
	DEFAULT(0, "默认状态"),
	
	FINISHED(1, "已完成"),
	
	;
	private Integer code;
	
	private String message;
	
	StageStatus(Integer code, String message) {
		this.code = code;
		this.message = message;
	}
	
	public static StageStatus valueOf(Integer value) {
		switch (value) {
			case 0:
				return DEFAULT;
			case 1:
				return FINISHED;
			default:
				log.error("StageStatus value error: value={}", value);
				throw new KaoChongException(ResultEnum.PARAM_ERROR);
		}
	}
}
